Given {b1} = 0.5, the power of the test with 48 degrees of freedom, for a true slope of 1.7, and a null of 0 would be 0.84 then there would be a 84% change of rejecting the null given that the true β1 was 1.7.
Drawing.
Found by hand the 90% CI for a stoping distance given a starting speed of 15mph is...
Drawing.
read.csv("Stop.csv", header = TRUE) -> data
n <-length(data)
X <-data$speed
Y <-data$dist
reg.stop <-lm(Y ~ X)
new.dat <-data.frame(X=15)
predict(reg.stop, newdata=new.dat, interval="confidence", level=0.90)
## fit lwr upr
## 1 41.40704 37.74843 45.06564
ci <- predict(reg.stop, newdata=new.dat, interval="confidence", level=0.90)
We can be 90% confident that the mean stopping distance, in ft, at 15mph is somewhere between (37.748435), (45.065638)
90% prediction interval for the stopping distance of a new driver whose speed is 15 mph.
Drawing.
predict(reg.stop, newdata=new.dat, interval="predict", level=0.90)
## fit lwr upr
## 1 41.40704 15.35386 67.46022
ci <- predict(reg.stop, newdata=new.dat, interval="predict", level=0.90)
We can be 90% confident in predicting that a new stopping test conducted at 15mph would produce a stopping distance, in ft, somewhere between (15.3538569), (67.4602161)
A 90% prediction interval for the mean stopping distance of three new drivers each of whose speed is 15 mph.
Drawing.
ci.reg(reg.stop, new.dat, type = 'nm', alpha=0.10,m=3) -> threeRep
threeRep[3:4]
## Lower.Band Upper.Band
## 1 26.07147 56.7426
The interval for the total stopping distance for all three tests would be between 78.2144069 and 170.2278121
A 95% confidence band for the simple linear regression line predicting stopping distance using speed.
ggplot(data, aes(x=speed, y=dist)) +
geom_point(color='#2980B9', size = 4) +
geom_smooth(method=lm, color='#2C3E50') +
xlab("Spead (mph)") +
ylab("Stopping Dist. (ft)") +
theme_minimal()
## `geom_smooth()` using formula 'y ~ x'